home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Floppyshop 2
/
Floppyshop - 2.zip
/
Floppyshop - 2.iso
/
diskmags
/
3565-4.665
/
dmg-4385
/
issue_10
/
11.pne
< prev
next >
Wrap
Text File
|
1987-04-21
|
5KB
|
134 lines
SPRITES.......QUESTIONS AND ANSWERS
ARTICLE BY DEANO
STOS sprites can certainly be a pain sometimes, well most times....oh
all right, they are a COMPLETE PAIN!!! The aim of this article is to
make using sprites a little easier to understand so there will be less
headaches and naughty words when using them.
The default sprites in STOS are software sprites, meaning that STOS has
to do a lot of work with them which makes them slow and flickery. It
spends a fair bit of processor time updating them and with them working
on interupt...also adds to problems.
Here is a few tipical questions about them along with answers...
QUESTION:- The command 'sprite 16,100,120,4' produces an error.
ANSWER:- This is because STOS only allows up to 15 sprites on the
screen at the same time. Trying to put more than this on screen at
once will produce a SPRITE error.
QUESTION:- The sprite flickers when it moves.
ANSWER:- This is because of the telly picture tube updating causing
the sprite to flicker when it passes it. Use the 'screen swap' command
to avoid this.
QUESTION:- How can I get the sprites moving more smoothly?
ANSWER:- Yes, STOS updates the sprites every 50th of a second. This
can lead to problems with speed and movement so you're best of using
the 'update off' command and updating them yourself with the update
command like this....
10 key off : hide : update off
20 sprite 1,X,Y,4 : update
QUESTION:- The more sprites I use, the slower they get.
ANSWER:- Again this is due to STOS using a lot of time to update them
all, try using less sprites on the screen at the same time. For a
shoot em up game you could have about five sprites on screen at any
one time and replace each one as it gets killed.
QUESTION:- Large sprites are difficult to handle.
ANSWER:- Yes they are...the bigger the sprite, the more time STOS uses
to update them. If you must have large sprites then use as few as
possible...about two or three on screen at the same time.
QUESTION:- The sprite flashes on screen.
ANSWER:- This is because it has colour 2 in it, STOS always flashes
this colour. Use the 'flash off' command.
QUESTION:- If I place the sprite on a picture, the colours of the
sprites are different to what they were.
ANSWER:- Pictures and sprites have their own separate palettes. When
you load a picture to the screen or unpack one from a bank STOS
adjusts its palette to the one of the screen so the sprite gets the
same palette. Load your sprites back into the 'Sprite Definer', grab
the palette from your background picture and re-colour the sprites
with the pictures colours.
QUESTION:- If I place a sprite on screen, its colours change.
ANSWER:- Again this is due to the sprite and the screen having two
different palettes. Unlike pictures STOS does'nt adjust his palette to
the one of the sprite, you have to do it yourself like this...
10 key off : mode 0 : flash off
20 XP=hunt(start(1) to start(1)+length(1),"PALT")
30 XP=XP+4 : for I=0 to 15 : colour I,deek(I*2+XP) : next I
QUESTION:- The sprite has'nt appeared on screen.
ANSWER:- There are two ways this can happen.
1> The image number you used is a blank space in the sprite
bank, so STOS displays a blank space.
2> You've given the X and Y parameters a negative value, IE: you've
typed 'sprite 1,-50,-100,4', putting it off the screen.
QUESTION:- Can I display sprites in medium rez?
ANSWER:- Yes, define them with the 'Sprite2' accessory.
QUESTION:- How can I animate about 20 images, ANIM won't do it.
ANSWER:- The 'anim' command only stores about 10 to 15 images at a
time. You'll have to animate them yourself like this.
10 key off : flash off : mode 0
20 for X=1 to 20
30 sprite 1,100,100,X : wait 20
40 next X
The 'wait' command controls the speed of the animation.
QUESTION:- How do I control a sprite using the joystick.
ANSWER:- Don't use the move command for this, it does'nt stop when you
want it to. Instead, use this routine...
10 key off : mode 0
20 if jleft then X=X-2
30 if jright then X=X+2
40 if jup then Y=Y-2
50 if jdown then Y=Y+2
60 sprite 1,X,Y,1 : wait vbl
70 goto 20
QUESTION: Why can't I move the sprite against a scrolling background?
ANSWER:- Because STOS updates scrolling quicker than it updates
sprites causing them to jerk. The best thing to do is use the 'bob'
and 'world' commands from the Missing Link extension.
Errm......the final bit.
Well thats it for this article. I hope its been useful. Actually most
STOS coders use pre-shifted sprites these days but if you are just
learning then I'm sure you'll find this article useful.
This is Deano signing off......